{% extends 'base.html' %}

{% block content %}
    <div class="row">
        <div class="col-md-10 offset-md-1">
            <h1 class="text-center mt-4">{{ title }}</h1>
            {#novalidate暂时取消浏览器的校验#}
            <form method="POST" novalidate> {#{{ form.hidden_tag() }}#}
                {{ form.csrf_token }}
                <div class="form-group">
                    {{ form.username.label(class="form-control-label") }}
                    {% if form.username.errors %}
                        {{ form.username(class="is-invalid form-control form-control-lg") }}
                        <div class="invalid-feedback">
                            {% for error in form.username.errors %}
                                <span>{{ error }}</span>
                            {% endfor %}
                        </div>
                    {% else %}
                        {{ form.username(class="form-control form-control-lg") }}
                    {% endif %}
                </div>
                <div class="form-group">
                    {{ form.email.label(class="form-control-label") }}
                    {% if form.email.errors %}
                        {{ form.email(class="is-invalid form-control form-control-lg") }}
                        <div class="invalid-feedback">
                            {% for error in form.email.errors %}
                                <span>{{ error }}</span>
                            {% endfor %}
                        </div>
                    {% else %}
                        {{ form.email(class="form-control form-control-lg") }}
                    {% endif %}
                </div>
                <div class="form-group">
                    {{ form.password.label(class="form-control-label") }}
                    {% if form.password.errors %}
                        {{ form.password(class="is-invalid form-control form-control-lg") }}
                        <div class="invalid-feedback">
                            {% for error in form.password.errors %}
                                <span>{{ error }}</span>
                            {% endfor %}
                        </div>
                    {% else %}
                        {{ form.password(class="form-control form-control-lg") }}
                    {% endif %}
                </div>
                <div class="form-group">
                    {{ form.password2.label(class="form-control-label") }}
                    {% if form.password2.errors %}
                        {{ form.password2(class="is-invalid form-control form-control-lg") }}
                        <div class="invalid-feedback">
                            {% for error in form.password2.errors %}
                                <span>{{ error }}</span>
                            {% endfor %}
                        </div>
                    {% else %}
                        {{ form.password2(class="form-control form-control-lg") }}
                    {% endif %}
                </div>
                <div class="form-group">
                    {{ form.submit(class="btn btn-outline-primary") }}
                </div>
            </form>
            <div class="border-top pt-1 pb-3">
                <small class="text-muted">
                    已经有账号？<a href="{{ url_for('auth.login') }}" class="ml-1">登录</a>
                </small>
            </div>
        </div>
    </div>
{% endblock %}
